function LynxSpirit_CombineChk(pUnit, event)
   if pUnit:GetHealthPct() < 20 and Didthat == nil then
    pUnit:RemoveEvents()
    pUnit:Despawn(1,0)
    Didthat = 1
    pUnit:RegisterEvent("Halazzi_Combine3Chk",1,0)
   elseif Didthat == 1 then
    pUnit:Despawn(1,0)
    pUnit:RegisterEvent("Halazzi_Combine3",1,0)
   end
end

function Halazzi_Combine3Chk(pUnit, event)
   if pUnit:GetHealthPct() < 20 and Didthat == nil then
    pUnit:RemoveEvents()
    pUnit:RegisterEvent("Halazzi_Combine3",1,0)
    Didthat = 1
    pUnit:RegisterEvent("LynxSpirit_CombineChk",1,0)
   elseif Didthat == 1 then
    pUnit:RegisterEvent("Halazzi_Combine3",1,0)

   end
end

function Halazzi_Combine3(pUnit, event)
timer=math.random(5000, 15000)
    pUnit:RemoveEvents()
    pUnit:SetHealthPct(25)
    pUnit:SetModel(21632)
    pUnit:PlaySoundToSet(12022)
    pUnit:SendChatMessage(12,0,"Spirit! Come back to me...")
    pUnit:RegisterEvent("Halazzi_Frenzy",10000,0)
    pUnit:RegisterEvent("Halazzi_Lash1",timer,1)
end

function Halazzi_OnKill(Unit, event)
    Killchoice=math.random()
    if Killchoice > .5 then
    Unit:SendChatMessage(12,0,"Ya can't fight da power!")
    Unit:PlaySoundToSet(12026)
    else
    Unit:SendChatMessage(12,0,"You gonna fail!")
    Unit:PlaySoundToSet(12027)
    end
end

function LynxSpirit_OnLeaveCombat(Unit)
    Unit:RemoveEvents()
    Unit:Despawn(1,0)
    Didthat = nil
end

function Halazzi_OnLeaveCombat(Unit)
    Unit:RemoveEvents()
    Unit:SetModel(21632)
    Didthat = nil
end

function Halazzi_OnDied(Unit)
    Unit:PlaySoundToSet(12028)
    Unit:SendChatMessage(12,0,"Chaga... choka'jinn.")
                Unit:RemoveEvents()
end


RegisterUnitEvent(23577,1,"Halazzi_OnAgro")
RegisterUnitEvent(23577,2,"LynxSpirit_OnLeaveCombat")
RegisterUnitEvent(24224,2,"Halazzi_TotemOnLeaveCombat")
RegisterUnitEvent(23577,2,"Halazzi_OnLeaveCombat")
RegisterUnitEvent(23577,3,"Halazzi_OnKill")
RegisterUnitEvent(24224,4,"Halazzi_TotemDeath")
RegisterUnitEvent(23577,4,"Halazzi_OnDied")
RegisterUnitEvent(24143,18,"LynxSpirit_OnSpawn")
RegisterUnitEvent(24224,18,"Halazzi_TotemSpell")
